package com.cms.recursoshumanos.facade;

import com.cms.recursoshumanos.constant.Constant;
import com.cms.recursoshumanos.handler.WServiceCall;
import com.cms.recursoshumanos.json.me.JSONParser;

public class CancelSolicitudCompraFacade
{

	private String strUsername;
	private String strPass;
	private int intIdSolicitud;
	private String strMotivo;

	
	public CancelSolicitudCompraFacade(String user,
												String password,
												int id_solicitud,
												String motivo)
	{
		this.strUsername = user;
		this.strPass = password;
		this.intIdSolicitud = id_solicitud;
		this.strMotivo = motivo;
	}


	
	public String enviarSolicitud1()
	{
		 
		JSONParser jParser = new JSONParser();
		return setValores(jParser.
						getJSONFromUrl(
								Constant.URL_WEBSERVICE, 
								WServiceCall.getInstance().cancelarSolicitudCompra(
																					strUsername, 
																					strPass,
																					intIdSolicitud,
																					strMotivo)));

	}
	
	public String enviarSolicitud() 
	{
		JSONParser jParser = new JSONParser();
		return jParser.
						setPetitionToUrl(
								Constant.URL_WEBSERVICE, 
								WServiceCall.getInstance().cancelarSolicitudCompra(
																						strUsername, 
																						strPass,
																						intIdSolicitud,
																						strMotivo));
        
	}
	
	
	public String setValores(String strResult)
	{
		if (strResult == null || strResult =="")
		{
			return Constant.CODE_NOT_SERVER_RESPONSE;
		}
		else
		{
			return Constant.CODE_OK;
		}
	}
	

	
}

